﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hive.Core;

namespace Hive.Bot.Tasks
{
    public interface ITask
    {
        IEnumerable<int> CalculateEfficiencies(IEnumerable<Ant> ants);
        void Assign(Ant ant);
        bool IsAssigned { get; }
        Order Execute();
    }

    public class Order
    {
        public int Efficiency { get; set; }
        public Ant Ant { get; set; }
        public Location Destination { get; set; }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = Efficiency;
                result = (result * 397) ^ this.Ant.Location.GetHashCode();
                result = (result * 397) ^ this.Destination.GetHashCode();
                return result;
            }
        }

        public override bool Equals(object obj)
        {
            Order other = obj as Order;
            if (other == null)
                return false;

            return Efficiency == other.Efficiency && this.Ant.Location == other.Ant.Location && this.Destination == other.Destination;
        }
    }
}
